home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_inv_batterym.cog < prev    next >
Text File  |  1998-09-17  |  788b  |  43 lines

  1. # DroidWorks
  2. # Battery item cog
  3. #
  4. # Each battery supplies 1000 power units
  5. #
  6. # Battery is in inventory bin 17
  7. # Power is in inventory bin 20
  8.  
  9. symbols
  10.  
  11. thing    player
  12.  
  13. message    activated
  14.  
  15. sound    batteryActivate=NRG00tBattUse.wav
  16.  
  17. end
  18.  
  19. # ========================================================================================
  20.  
  21. code
  22.  
  23. activated:
  24.     player = GetSourceRef();
  25.  
  26.     if (GetInv(player, 17) > 0)
  27.     {
  28.         if (GetInv(player, 20) < GetInvMax(player, 20))
  29.         {
  30.             print("using med battery");
  31.  
  32.             if (dwcheckDroidCaps(1048576)!=0) dwplayplayerspeech("", 511);
  33.  
  34.             PlaySoundlocal(batteryActivate, 1.0, 0.0, 0);
  35.             ChangeInv(player, 20, 3000);
  36.             ChangeInv(player, 17, -1);
  37.             if(GetInv(player, 17) == 0) SetInvAvailable(player, 17, 0);
  38.         }
  39.     }
  40.     return;
  41.  
  42. end
  43.